<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
    <meta http-equiv="description" content="This is my page" />
    <link href="/hrm/css/css.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/hrm/js/ligerUI/skins/Aqua/css/ligerui-dialog.css"/>
    <link href="/hrm/js/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/hrm/js/jquery-1.11.0.js"></script>
    <script type="text/javascript" src="/hrm/js/jquery-migrate-1.2.1.js"></script>
    <script src="/hrm/js/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="/hrm/js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="/hrm/js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="/hrm/js/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
    <link href="/hrm/css/pager.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript">

        function register(){
            var username = $("#username");
            var loginname = $("#loginname");
            var password = $("#password");
            var msg = "";
            if ($.trim(username.val()) == ""){
                msg = "姓名不能为空！";
                username.focus();
            }else if ($.trim(loginname.val()) == ""){
                msg = "登录名不能为空！";
                loginname.focus();
            }else if($.trim(loginname.val()).length<6 || $.trim(loginname.val()).length>20){
                msg = "登录名需要大于6位小于20位！";
                loginname.focus();
            }else if ($.trim(password.val()) == ""){
                msg = "密码不能为空！";
                password.focus();
            }
            if (msg != ""){
                $.ligerDialog.error(msg);
                return false;
            }
            $.ajax({
                url:"/hrm/register/addUser",
                data:{"username":username.val(),"status":2,"loginname":loginname.val(),"password":password.val()},
                type:"POST",
                dataType:"JSON",
                success:function(res){
                    if(res && res.msg){
                        username.val("");
                        loginname.val("");
                        password.val("");
                        $.ligerDialog.error(res.msg);
                    }
                },
                error:function(error){
                    console.log(error);
            }
            })
        }




    </script>
</head>
<body>
  <div>

          <!-- 隐藏表单，flag表示添加标记 -->
          <table width="100%" border="0" cellpadding="0" cellspacing="10" class="main_tab">
              <tr><td class="font3 fftd">
                  <table>
                      <tr>
                          <td class="font3 fftd">姓&nbsp;名：<input type="text" name="username" id="username" size="20"/></td>

                          <input type="hidden" name="status" value="2">

                      </tr>

                      <tr>
                          <td class="font3 fftd">登录名：<input name="loginname" id="loginname" size="20" /></td>

                      </tr>
                      <tr>
                          <td class="font3 fftd">密&nbsp;码：<input type="password" name="password" id="password" size="20" /></td>
                      </tr>

                  </table>
              </td></tr>
              <tr><td class="main_tdbor"></td></tr>

              <tr>
                  <td align="left" class="fftd">
                      <input type="button" id="register" onclick="register()" value="注册">&nbsp;&nbsp;



                  </td>



              </tr>
          </table>

  </div>

</body>
</html>